/*Project Tracking System*/
/* Finalized */

#ifndef PROJ_CLASSES
#define PROJ_CLASSES 1

#if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__)
#include <windows.h>
#include <stdlib.h>
#define SETPOS(){									\
	HWND console = GetConsoleWindow();				\
	RECT r;											\
	GetWindowRect(console, &r);						\
	MoveWindow(console, 100, 100, 800, 800, TRUE);	\
}
#define PAUSE(){									\
	getchar();										\
}
#define OPENFILE(command){							\
	system(command);								\
}
#define _OS "WINDOWS"
#elif defined(__unix) || defined(unix)
#include <stdlib.h>
#define OPENFILE(command){							\
	execl("/bin/sh","sh","-c",command,NULL);		\
}
#define _OS "UNIX"
#elif defined(__linux) || defined(linux)
#define _OS "LINUX"
#elif defined(__APPLE__) || defined(APPLE)
#define _OS "APPLE"
#else
#define _OS "UNKNOWN"
#endif

#include <iostream>
#include <fstream>
using namespace std;

class Task;			// Task
class User;			// User - Project Manager, Member
class UserTask;		// Association class btw User & Task
class PDate;		// Project Date

void printMenu(int);

class Project{

private:
	int projectID;
	string projectOwnerID;
	string projectName;
	Task* taskList;
	User* userList;
	UserTask* assoList;
	PDate* projectDate;
	float projectProgress;
	bool checkProject(int);

public:
	Project();
	User login();
	bool checkUser(User);
	bool newUser(int);
	void setName();
	void setDate();
	void setProgress(int);
	void setID(int);
	bool modifyProject();
	bool modifyUser();
	bool deleteUser();
	string getStartDate(int);
	string getEndDate(int);
	int getID();
	string getprojOwner(int);
	string getprojName(int);
	float getprojProg(int);
	bool manageAsso();
	bool updateTask();
};

class Task{
private:
	string taskID;
	string taskName;
	PDate* taskDate;
	float taskProgress;
	Task* subTask;
	bool checkTask(string);
public:
	void setName();
	void setDate();
	void setProgress(int);
	string getTaskName(string);
	float getTaskProg(string);
	string getStartDate(string);
	string getEndDate(string);
	bool editTask();
};

class User{	//used
private:
	int userID;
	string userName;
	string userPassword;
	string position;
public:
	void setUserID();
	void setUserName();
	void setUserPassword();
	int getUserID();
	string getUserName();
	string getUserPassword();
};

class PM : public User{};
class Member : public User{};

class UserTask{
private:
	User* user;
	Task* task;
};

class PDate{
private:
	string startDate;
	string endDate;
public:
	string getStartDate();
	string getEndDate();
	void setStartDate(string);
	void setEndDate(string);
};

class Controller{
private:
	Project* project;
public:
	void createProject();
	bool createUser(int);
	void modifyProject();
	void modifyUser();
	void deleteUser();
	void deleteProject();
	void deleteTask();
	void manageAsso();
	void manageTask();
	void updateTask();
	void saveProject();
	void openProject();
	void createTask();
	void editTask();
	void viewInfo();
	void viewDate();

	bool login();
};

#endif